package com.web.service.impl;

import com.web.dao.StudentDAO;
import com.web.dao.impl.StudentDAOImpl;
import com.web.entity.Student;
import com.web.service.StudentService;

import java.util.List;

/**
 * 学生业务逻辑实现类
 */
public class StudentServiceImpl implements StudentService {

    private StudentDAO studentDAO = new StudentDAOImpl();
    @Override
    public List<Student> findAllStudents() {
        return studentDAO.selectAllStudents();
    }
    //搜索学生，传入关键字，搜索名字有该字的学生
    @Override
    public List<Student> findStudentkeyword(String keyword) {
        return studentDAO.findStudentkeyword(keyword);
    }
    //通过id查询学生，传入学生id，查询学生信息
    @Override
    public Student findStudentById(int id) {
        return studentDAO.findStudentById(id);
    }

    //传入学生信息，实现学生插入
    @Override
    public boolean addStudent(Student student) {
        return studentDAO.addStudent(student);
    }

    //传入学生信息，实现按id修改学生
    @Override
    public boolean updateStudent(Student student) {
        return studentDAO.updateStudent(student);
    }

    //传入学生id，实现学生删除
    @Override
    public boolean removeStudent(int id) {
        return studentDAO.deleteStudent(id);
    }
}